package com.ssy.lingxi.pay.api.feign;

import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.pay.api.fallback.CreditControllerFallback;
import com.ssy.lingxi.pay.api.model.vo.request.*;
import com.ssy.lingxi.pay.api.model.vo.response.CreditFeignDetailVO;
import com.ssy.lingxi.pay.api.model.vo.response.CreditPayResponseVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.validation.Valid;

/**
 *
 * @author 伍将
 * @date 2020/8/20
 * @version 2.0.0
 */

@FeignClient(name = "pay-service", fallback = CreditControllerFallback.class)
public interface ICreditControllerFeign {

    /**
     * 支付能力-初始化授信 会员支付参数配置勾选“授信额度支付”时调用
     * @author 伍将
     * @date 2020/8/20
     **/
    @RequestMapping("/pay/credit/feign/init")
    Wrapper<Void> init(@RequestBody @Valid CreditInitVO initVO);

    /**
     * 查询会员授信
     * @param feignVO 上下级会员Id
     * @return 查询结果，如无授信，返回Null
     */
    @RequestMapping(value = "/pay/credit/feign/find", method = RequestMethod.POST)
    Wrapper<CreditFeignDetailVO> findCredit(@RequestBody @Valid CreditFeignVO feignVO);

    /**
     * 支付能力-新增会员授信 审批通过会员调用
     * @author 伍将
     * @date 2020/8/20
     **/
    @RequestMapping("/pay/credit/feign/add")
    Wrapper<Void> add(@RequestBody @Valid CreditAddVO creditAddVO);

    /**
     * 支付能力-授信支付
     * @author 伍将
     * @date 2020/11/3
     **/
    @RequestMapping("/pay/credit/feign/pay")
    Wrapper<CreditPayResponseVO> pay(@RequestBody @Valid CreditPayVO payVO);

    /**
     * 冻结授信
     * @author 伍将
     * @date 2020/12/1
     **/
    @RequestMapping("/pay/credit/feign/updateCreditStatus")
    Wrapper<Void> frozenCredit(@RequestBody @Valid FrozenCreditVO frozenCreditVO);

    /**
     * 支付能力-授信退款
     * @param refundVO 接口参数
     * @return 操作结果
     */
    @RequestMapping("/pay/credit/feign/refund")
    Wrapper<String> refund(@RequestBody @Valid CreditRefundVO refundVO);
}
